home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 58 / pcpp58a.iso / extras / quake 3 source / Q3A_ToolSource.exe / Main / SelectedFace.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-02  |  3.8 KB  |  115 lines

  1. //-----------------------------------------------------------------------------
  2. //
  3. // $LogFile$
  4. // $Revision: 1.1.1.4 $
  5. // $Author: ttimo $
  6. // $Date: 2000/01/18 00:18:13 $
  7. // $Log: SelectedFace.cpp,v $
  8. // Revision 1.1.1.4  2000/01/18 00:18:13  ttimo
  9. // merging in for RC
  10. //
  11. // Revision 1.3  2000/01/17 23:53:43  TBesset
  12. // ready for merge in sourceforge (RC candidate)
  13. //
  14. // Revision 1.2  2000/01/07 16:40:12  TBesset
  15. // merged from BSP frontend
  16. //
  17. // Revision 1.1.1.3  1999/12/29 18:31:45  TBesset
  18. // Q3Radiant public version
  19. //
  20. // Revision 1.1.1.1.2.1  1999/12/29 21:39:41  TBesset
  21. // updated to update3 from Robert
  22. //
  23. // Revision 1.1.1.3  1999/12/29 18:31:45  TBesset
  24. // Q3Radiant public version
  25. //
  26. // Revision 1.2  1999/11/22 17:46:47  Timo & Christine
  27. // merged EARadiant into the main tree
  28. // bug fixes for Q3Plugin / EAPlugin
  29. // export for Robert
  30. //
  31. // Revision 1.1.4.2  1999/11/14 16:26:13  Timo & Christine
  32. // first beta of the ritualmap surface plugin
  33. //
  34. // Revision 1.1.4.1  1999/11/03 20:38:02  Timo & Christine
  35. // MEAN plugin for Q3Radiant, alpha version
  36. //
  37. // Revision 1.1.2.1  1999/10/27 08:34:28  Timo & Christine
  38. // preview version of the texture tools plugin is ready
  39. // ( TexTool.dll plugin is in Q3Plugin module )
  40. // plugins can draw in their own window using Radiant's qgl bindings
  41. //
  42. //
  43. // DESCRIPTION:
  44. // Quick interface hack for selected face interface
  45. // this one really needs more work, but I'm in a hurry with TexTool
  46.  
  47. #include "stdafx.h"
  48.  
  49. HGLRC WINAPI QERApp_GetQeglobalsHGLRC()
  50. {
  51.     return g_qeglobals.d_hglrcBase;
  52. }
  53.  
  54. // pWinding is supposed to have MAX_POINTS_ON_WINDING
  55. int WINAPI QERApp_GetFaceInfo(_QERFaceData *pFaceData, winding_t *pWinding)
  56. {
  57.     int size;
  58.  
  59.     if (g_ptrSelectedFaces.GetSize() > 0)
  60.     {
  61.         if (!g_qeglobals.m_bBrushPrimitMode)
  62.         {
  63.             Sys_Printf("Warning: unexpected QERApp_GetFaceInfo out of brush primitive mode\n");
  64.             return 0;
  65.         }
  66.         //++timo NOTE: let's put only what we need for now
  67.     face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(0));
  68.         strcpy( pFaceData->m_TextureName, selFace->texdef.name );
  69.         VectorCopy( selFace->planepts[0], pFaceData->m_v1 );
  70.         VectorCopy( selFace->planepts[1], pFaceData->m_v2 );
  71.         VectorCopy( selFace->planepts[2], pFaceData->m_v3 );
  72.         pFaceData->m_bBPrimit = true;
  73.         memcpy( &pFaceData->brushprimit_texdef, &selFace->brushprimit_texdef, sizeof(brushprimit_texdef_t) );
  74.         size = (int)((winding_t *)0)->points[selFace->face_winding->numpoints];
  75.         memcpy( pWinding, selFace->face_winding, size );
  76.         return 1;
  77.     }
  78.     return 0;
  79. }
  80.  
  81. int WINAPI QERApp_SetFaceInfo(_QERFaceData *pFaceData)
  82. {
  83.     if (g_ptrSelectedFaces.GetSize() > 0)
  84.     {
  85.         if (!g_qeglobals.m_bBrushPrimitMode)
  86.         {
  87.             Sys_Printf("Warning: unexpected QERApp_SetFaceInfo out of brush primitive mode\n");
  88.             return 0;
  89.         }
  90.     face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(0));
  91.     brush_t *selBrush = reinterpret_cast<brush_t*>(g_ptrSelectedFaceBrushes.GetAt(0));
  92.         //strcpy( selected_face->texdef.name, pFaceData->m_TextureName );
  93.         selFace->texdef.SetName(pFaceData->m_TextureName);
  94.         VectorCopy( pFaceData->m_v1, selFace->planepts[0] );
  95.         VectorCopy( pFaceData->m_v2, selFace->planepts[1] );
  96.         VectorCopy( pFaceData->m_v3, selFace->planepts[2] );
  97.         memcpy( &selFace->brushprimit_texdef, &pFaceData->brushprimit_texdef, sizeof(brushprimit_texdef_t) );
  98.         Brush_Build( selBrush );
  99.         Sys_UpdateWindows(W_ALL);
  100.         return 1;
  101.     }
  102.     return 0;
  103. }
  104.  
  105. void WINAPI QERApp_GetTextureSize( int Size[2] )
  106. {
  107.     if (g_ptrSelectedFaces.GetSize() > 0)
  108.     {
  109.     face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(0));
  110.         Size[0] = selFace->d_texture->width;
  111.         Size[1] = selFace->d_texture->height;
  112.     }
  113.     else
  114.         Sys_Printf("WARNING: unexpected call to QERApp_GetTextureSize with no selected_face\n");
  115. }